Singlestore
Summary
This document covers the information to gather from Singlestore in order to configure a Qarbine data service. The styles available are SQL through a mySQL interface or a MongoDB API interface. For more information see https://www.singlestore.com/.
Singlestore Configuration
Sign on to your Singlestore account at https://portal.singlestore.com/.
Navigate as shown below.
One the far right click “...” and choose the option shown below.
MySQL Based Access
This style of access uses the Qarbine MySQL driver to interact with Singlestore. To obtain the necessary parameters click the tab shown below.
Kai™ MongoDB API Based Access
This style of access uses the Qarbine MongoDB driver and uses Singlestore Kai for interactions. SingleStore Kai™ is an API that offers compatibility and a performance alternative for applications built on MongoDB®. It provides a fast, easy, and powerful API that enables analytics on MongoDB data applications without any query changes, application migration, or data transformations. For detailed compatibility information and functional differences, it’s recommended to consult the Singlestore’s Kai page at https://www.singlestore.com/kai.
To obtain the necessary parameters click the tab shown below.
Qarbine Configuration
Compute Node Preparation
Determine which compute node service endpoint you want to run this data access from. That URL will go into the Data Service’s Compute URL field. Its form is “https://domain:port/dispatch”. A sample is shown below.
The port number corresponds to a named service endpoint configured on the given target host. For example, the primary compute node usually is set to have a ‘main’ service. That service’s configuration is defined in the ˜./qarbine.service/config/service.main.json file.
When using the MySQL interaction inside that file the following driver entry is required
"drivers" :[
. . .
"./driver/mySqlDriver.js"
]
The relevant configuration file name for non primary (main) Qarbine compute nodes is service.NAME.json. Remember to have well formed JSON syntax or a startup error is likely to occur. If you end up adding that entry then restart the service via the general command line syntax
pm2 restart <service>
For example,
pm2 restart main
or simply
pm2 restart all
Data Service Definition
Open the Administration Tool.
Navigate to the Data Services tab.
A data service defines on what compute node a query will run by default along with the means to reach to target data. The latter includes which native driver to use along with settings corresponding to that driver. Multiple Data Sources can reference a single Data Service. The details of any one Data Service are thus maintained in one spot and not spread out all over the place in each Data Source. The latter is a maintenance and support nightmare.
To begin adding a data service click
On the right hand side enter a name and optionally a description.
Set the Compute URL field based on the identified compute node above. Its form is “https://domain:port/dispatch”. A sample is shown below.
Using the MySQL Interface
Choose the driver and set the values as shown below.
Enter the values from the Singlestore SQL IDE tab (with the desired user and password values) into the fields shown below.
You can reference environment variables using the syntax %NAME%. Any strings should be quoted and the key\value pairs separated by commas.
Test your settings by clicking on the toolbar image highlighted below.
The result should be something similar to the following
Save the Data Service by clicking on the image highlighted below.
The data service will be known at the next log on time.
MySQL with SSL Certificates
Background on using certificates with Singlestore’s MySQL interface can be found on this page
https://docs.singlestore.com/db/v8.7/security/encryption/ssl-secure-connections/
Qarbine uses node.js and follows this interfacing pattern.
https://docs.singlestore.com/cloud/developer-resources/connect-with-application-development-tools/connect-with-node-js/connect-with-node-js-using-ssl/
Use the following pattern which requires the files to be in the ˜/qarbine.service/config folder and the file names starting with "singlestore".
ssl.ca = "configContent:singlestore-bundle.pem",
If Qarbine’s “Resource” feature is available then upload the PEM as a resource and then reference it using the pattern
ssl.ca = "resourceContent:singlestore-bundle.pem",
The value after the colon is the Qarbine resource name. The service.NAME.json file must also have an entry in the supportResources:[] list for the resource name. Access to Qarbine’s resource management feature varies by edition and other factors.
Information on troubleshooting SSL connections can be found at https://docs.singlestore.com/db/v8.7/security/encryption/troubleshoot-openssl-3-0-connections/.
Using the Kai (MongoDB) Interface
Provide a name and optional description.
Choose the MongoDB driver.
Enter the values from the Singlestore MongoDB tab (with the desired user and password values) into the fields shown below.
The connection string will be in the following format:
mongodb://<user>:<password>@svc-XXX-mongo.YYY.svc.singlestore.com:27017/
?authMechanism=PLAIN&tls=true&loadBalanced=true
Adjust the user and password values in the connection string. Ensure that the loadBalanced=true parameter is included in the connection string, as it is critical for authentication and connectivity.
For more detailed information, you can refer to the SingleStore documentation on Getting Started with SingleStore Kai at
https://docs.singlestore.com/cloud/reference/singlestore-kai/getting-started-with-singlestore-kai/#access-the-api
General information can be found at
https://docs.singlestore.com/cloud/reference/singlestore-kai/getting-started-with-singlestore-kai/
You can reference environment variables using the syntax %NAME%. Any strings should be quoted and the key\value pairs separated by commas.
Test your settings by clicking on the toolbar image highlighted below.
The result should be similar to the following.
Save the Data Service by clicking on the image highlighted below.
The data service will be known at the next log on time. Next, see the MongoDB API query interaction and any tutorial for information on interacting with Singlestore using the Kai interface from Qarbine.
References
A variety of resources can be found at https://www.singlestore.com/resources/.